package inheritance;

public class Car {
	
		
		private String make;
		private String model;
		private String color;
		private int year;
		private int maximumSpeed = 140;
		private int currentSpeed;
		private boolean started;
		// this is how we define constructor 
		/*
		 *  if u donot provide constructor like this, then the complier will give default constructor without arguments.
		 */
		// if u give this, then the complier will not provide default constructor.
		
		Car(){
			
		}
		
		Car (String make, String model, int year){
			this.make=make;
			this.model=model;
			this.year=year;
			
		}
		Car(String make, String model, int year, String color){
			
			this.model=model;
			this.make = make;
			this.year = year;
			this.color = color;
			
		}

		void start() {

			System.out.println("I am starting the car");

			started = true;
			currentSpeed = 0;
		}

		void stop() {

			System.out.println("I am stopping the car");

			started = false;
			currentSpeed = 0;
		}

		void changeColor(String newColor) {

			color = newColor;

		}

		int accelerate(int howMuch) {
			
			int wishfulCurrentSpeed = currentSpeed + howMuch;
			
			if(wishfulCurrentSpeed > maximumSpeed){
				
				currentSpeed = maximumSpeed;
			}else {
				
				currentSpeed = wishfulCurrentSpeed;
			}
			
			
			return currentSpeed;

		}

		public String getMake() {
			return make;
		}

		

		public String getModel() {
			return model;
		}

		

		public String getColor() {
			return color;
		}

		public void setColor(String color) {
			this.color = color;
		}

		public int getYear() {
			return year;
		}

		

		public int getMaximumSpeed() {
			return maximumSpeed;
		}

		public void setMaximumSpeed(int maximumSpeed) {
			this.maximumSpeed = maximumSpeed;
		}

		public int getCurrentSpeed() {
			return currentSpeed;
		}

		public void setCurrentSpeed(int currentSpeed) {
			this.currentSpeed = currentSpeed;
		}

		public boolean isStarted() {
			return started;
		}

		public void setStarted(boolean started) {
			this.started = started;
		}

		
		

	}


